package crudfx.control;

import javafx.scene.*;
import javafx.scene.input.*;
import javafx.geometry.*;
/**
 * @profile desktop
 * @author Sergey Surikov
 */
public class Dragger extends CustomNode{
    public var content:Node;
    public var x:Number;
    public var y:Number;
    var pressedX:Number;
    var pressedY:Number;
    var group:Group;
    public override function create():Node{
	return group=Group {
		blocksMouse:true
		translateX:bind x with inverse
		translateY:bind y with inverse
		content:bind content
		//cursor:Cursor.MOVE
		onMousePressed:function (e:MouseEvent):Void{
			pressedX=this.x;
			pressedY=this.y;
			}
		onMouseDragged:function (e:MouseEvent):Void{
			x=e.dragX+pressedX;
			y=e.dragY+pressedY;
		    }
		};
	}
    }
